import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login'
import Home from '../components/Home'
import ArticleList from '../components/ArticleList'
import ArticlePublish from '../components/ArticlePublish'
import UsersManage from '../components/UsersManage'
import ClassManage from '../components/ClassManage'
import DataStatistics from '../components/DataStatistics'
import ArticleManage from '../components/ArticleManage'
import test from '../components/test'

Vue.use(Router)

export default new Router({
  mode:'history',//修改前端路由模式，端口号后面没有/#/
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path:'/test',
      name:'test',
      component:test
    },
    {
      path:'/home',
      name:'Home',
      component: Home,
      redirect:'/usersManage',
      meta:{
        requireAuth:true,
        title:'首页'
      },
      children:[
        {
          path: '/articleManage',
          name: 'articleManage',
          redirect:'/articleList',
          component: ArticleManage,
          meta:{
            requireAuth:true,
            title:'文章管理'
          },
          children:[
            {
              path: '/articleList',
              name: 'ArticleList',
              component: ArticleList,
              meta:{
                requireAuth:true,
                title:'文章列表'
              },
            },
            {
              path: '/articlePublish',
              name: 'ArticlePublish',
              component: ArticlePublish,
              meta:{
                requireAuth:true,
                title:'发表文章'
              },
            },
          ]
        },
        {
          path: '/usersManage',
          name: 'UsersManage',
          component: UsersManage,
          meta:{
            requireAuth:true,
            title:'用户管理'
          },
        },
        {
          path: '/classManage',
          name: 'ClassManage',
          component: ClassManage,
          meta:{
            requireAuth:true,
            title:'栏目管理'
          },
        },
        {
          path: '/dataStatistics',
          name: 'DataStatistics',
          component: DataStatistics,
          meta:{
            requireAuth:true,
            title:'数据统计'
          },
        },
      ]
    },
  ]
})
